INTRODUCTION§

Bitwise is a versatile, yet easy to use calculator with many unique features. It was specifically designed for programmers of personal computers and microprocessors. In fact, Bitwise is actually two calculators in one; with independent registers for integer and floating point math. Key features include:

• Reverse Polish Notation (RPN) operating logic

• Integer and floating point math modes

• Continuous memory of all registers, modes, and window position

• Convert between hexadecimal, decimal, octal, and binary

• Floating point values can be entered in fixed or scientific notation

• Choose from integer word sizes of 8, 16, and 32 bits

• Backspace key corrects input errors without retyping entire number

• Optional byte/nibble marks & leading zeros

• Pop-up stack register display with register selection

• Carry, overflow, and remainder flags

• Signed and unsigned integer modes

• Optional sign-extension of registers

• Add, subtract, multiply, divide, and modulus

• AND, OR, XOR, 1’s & 2’s complement

• Logical shift left, logical & arithmetic shift right

• Rotate left & rotate right, optionally through the carry flag

• Swap hi & lo register halves

• X Y register exchange key

• Stack roll down

• Temporarily view X register in another base

• Undo last operation

• Cut, Copy, and Paste via the clipboard

• Macintosh drag & drop support

• Calculator’s keypad can be hidden to save screen space

• Keyboard equivalents for most calculator functions

• Built-in user’s guide

• Low RAM, disk space, and screen size requirements

• Works with System 7.X and OS 8.X

• Native 68K & PPC fat application

SHAREWARE NOTICE§

Bitwise is shareware, which means you can use it on a trial basis for a few weeks to see if it meets your needs. If you continue to use Bitwise on a regular basis, please register your copy by mailing your shareware payment of $10 (U.S. funds only), along with your name, mailing address, and email address to:

  Eric Curtis
  Bitwise Registration
  212 Snow Camp Drive
  Apex, NC 27502  U.S.A.

You can also email your comments, suggestions, and bug reports to:

  boston84@aol.com

Upon receipt of your shareware payment, your registration information will be sent to you via email or U.S.P.S. Enter it in the registration dialog to eliminate the shareware reminder and enable any additional features. Once you register your copy of Bitwise, you are entitled to use future versions at no additional cost.

The latest version of Bitwise (and other fine software) is available at:

  http://members.aol.com/boston84/

INSTALLATION & SETUP§

Since Bitwise is an application, it can be installed virtually anywhere on your Macintosh hard drive or floppy disk. Simply drag Bitwise to the destination disk or folder. You may want to install an alias to Bitwise in the “Apple Menu Items” folder within your System Folder for convenient access from any program.

Bitwise now stores all its registers, modes, and window position in a Bitwise Preferences file within the Preferences folder of your System Folder. As a result, when you upgrade to a newer version, all of your current calculator information will be preserved.

USING REVERSE POLISH NOTATION§

Bitwise uses an operating logic called Reverse Polish Notation (RPN). If you are already familiar with RPN, you may want to skip ahead to the next section, titled BITWISE KEYS.

RPN works the same way in both integer and floating point math modes (examples in this section are shown using integer math). It allows you to perform complex calculations without the need for parentheses or storing & recalling intermediate values. Instead, calculations are performed using a memory “stack”.

To perform a calculation, simply key in the first number, press the ENTER key, key in the second number, and finally press the desired operator key. For example:

First, set the number base to decimal and clear the display by pressing the Dec & BSP keys. (Note: All examples in this section are in base 10 unless otherwise noted.)

        To Calculate    Press            Display Shows
                        Dec BSP                      0
        1234 + 1        1234 ENTER 1 +            1235
        1234 - 10       1234 ENTER 10 -           1224

The ENTER key is used to separate two numbers that are keyed in one after the other. However, calculations can also be performed using values already present in the display. For example:

        To Calculate    Press            Display Shows
        (this value is already in the display)    1224
        1224 x 5        5 x                       6120
        6120 ÷ 20       20 ÷                       306

Note that in the preceding example the ENTER key was not needed. This is because in both calculations the first number (1224 and 6120) was already in the display.

The Memory Stack: The stack consists of four memory registers, referred to as X, Y, Z, and T. The number in the X register is always shown in the calculator’s display. The registers are “stacked”, one on top of the other, starting with the X register at the bottom. The Y register appears on top of the X register, the Z register appears on top of the Y register, and finally the T register appears on top of the Z register, at the top of the stack.

        Stack
        T   0
        Z   0
        Y   0
        X   0 (display always shows X register)

Stack Lift and Stack Drop: Bitwise performs calculations by manipulating numbers on the stack. Some operations cause the stack to be “lifted”. For example:

If the X register contains 2 and the Y register contains 1, keying in 3 causes the following to occur. The value in T gets pushed off the top of the stack and is lost. The value in Z gets copied to T, the value in Y gets copied to Z, the value in X gets copied to Y, and finally the value 3 replaces the original value in X.

        Before        After
        Stack         Stack
        Lift          Lift  
        T   32        T    0
        Z    0        Z    1
        Y    1        Y    2
        X    2        X    3

Other operations cause the stack to be “dropped”. For example:

If the X register contains 4 and the Y register contains 5, pressing + causes the value in X to be added to the value in Y and the result replaces the original value in X. Furthermore, the value in Z gets copied to Y and the value in T gets copied to Z, thus completing the stack drop.

        Before        After
        Stack         Stack
        Drop          Drop  
        T   58        T   58
        Z    0        Z   58
        Y    5        Y    0
        X    4        X    9

Also note that the value in T was regenerated when the stack dropped. This allows it to be used as a constant in repetitive calculations.

More Complex Calculations: The RPN operating logic makes it easy to perform complex calculations without the need for parentheses or storing & recalling intermediate values. For example:

        To Calculate    Press            Display Shows
        (12-7) x (3+5)                     (any value)
                        12 ENTER                    12
                         7 -                         5
                         3 ENTER                     3
                         5 +                         8
                         x                          40

BITWISE KEYS§

This section describes the function of each key on the Bitwise keypad. Refer to the following figure.

Special Note: Some keys have a tiny dot in their upper-left corner. This signifies that the behavior of these keys can be modified (as described below) by clicking on them while holding down the option key.

 

Hex, Dec, Oct, Bin: These keys put Bitwise into integer math mode and select the number base (hexadecimal, decimal, octal, or binary) in which the calculator’s stack registers are displayed. Clicking one of these keys at any time terminates digit entry and converts all registers to the selected number base. Holding down the option key while clicking any of these keys temporarily displays the X register in the selected base until the option key is released. The current number base is indicated in the status area below the X register display.

Flt: The Flt key puts Bitwise into floating point math mode.

0 thru 9, A thru F: These keys are used for digit entry. The valid range of digits is determined by the selected number base and math mode. Attempting to enter a digit greater than that allowed in the current number base results in a warning sound. Digits can also be entered from the keyboard and numeric keypad.

In floating point mode, use the E (exponent) key to enter numbers multiplied by powers of 10 (e.g. 1.2e+3).

Decimal Point (.): This key adds a decimal point to the floating point number being entered.

S:U: The S:U key toggles between signed integer and unsigned integer modes. Holding down the option key while clicking this key temporarily shows the X register in the opposite mode until the option key is released.

+, –, x, ÷, MOD: These keys perform arithmetic operations (addition, subtraction, multiplication, division, and modulus) using the values in the X and Y registers. The stack is dropped after performing any of these operations and the result is placed in the X register. In integer mode, the +, –, x, and ÷ operations set or clear the Carry and Overflow flags based on the result of the calculation. The Overflow flag is set by either an overflow or underflow condition. In division and modulus operations, if the remainder is not zero, the RMD≠0 flag is set; otherwise the flag is cleared. These operations can also be performed from the keyboard by pressing the +, –, *, /, and % keys.

ENTER: When the ENTER key is pressed, digit entry is terminated and the stack is lifted. This operation can also be performed from the keyboard by pressing the return or enter key.

BSP: The BSP key is used to make corrections to a number being entered and to clear the X register. If digit entry is active (meaning that pressing a digit key doesn’t start a new number), pressing BSP deletes the last digit entered. The decimal point and exponent can also be deleted in floating point mode. If digit entry has been terminated, pressing BSP clears the X register to zero. (Pressing ENTER and most other function keys terminates digit entry; this means the next digit keyed in becomes part of a new number.) Holding down the option key while pressing BSP clears the X register whether digit entry is active or not. These operations can also be performed from the keyboard by pressing the delete key.

X><Y: The X><Y key exchanges the values in the X and Y registers. This operation can also be performed from the keyboard by pressing the tab key.

1’S: The 1’S key performs a one’s complement operation on the value in the X register. This operation is only available in integer mode. It can also be performed from the keyboard by pressing the ~ key.

CHS: In integer mode, the CHS (CHange Sign) key performs a two’s complement operation on the value in the X register. In floating point mode, it changes the sign of the mantissa in the X register. To change the sign of the exponent, press CHS immediately after pressing E (exponent), but before entering any exponent digits. This operation can also be performed from the keyboard by pressing the " key.

AND, OR, XOR: These keys perform bitwise AND, OR, and Exclusive-OR operations using the values in the X and Y registers. The stack is dropped after performing any of these operations and the result is placed in the X register. These operations are only available in integer mode. They can also be performed from the keyboard by pressing the &, |, and ^ keys.

RL, RR: These keys perform logical rotate-left and rotate-right operations (rotating left or right by one bit) on the value in the X register. Holding down the option key while clicking the RL or RR keys rotates the bits through the Carry flag. These operations are only available in integer mode. They can also be performed from the keyboard by pressing the  and  keys.

SL, SR: These keys perform logical shift-left and shift-right operations (shifting left or right by one bit) on the value in the X register. If a 1 is shifted out of either the left or right side of the word, the Carry flag is set. If a 0 is shifted out of either side, the Carry flag is cleared. Holding down the option key while clicking the SR key performs an arithmetic shift-right (preserving the sign bit) when in signed integer mode. These operations are only available in integer mode. They can also be performed from the keyboard by pressing the < and > keys.

BITWISE CALCULATOR MENU§

This section describes the function of each menu item in the Calculator menu.

Roll Down Stack: This menu item rolls down the stack registers. (i.e. the value in the Y register gets copied to the X register, the Z value gets copied to the Y register, the T value gets copied to the Z register, and finally the original X value gets copied to the T register). Rolling down the stack terminates digit entry.

        Before        After
        Roll          Roll
        Down          Down  
        T    4        T    1
        Z    3        Z    4
        Y    2        Y    3
        X    1        X    2

Transfer Stack: When in integer mode, this menu item copies all values from the Integer stack to the Floating Point stack, then switches to floating point mode. In floating point mode, it copies all values from the Floating Point stack (rounding up or down when necessary) to the Integer stack, then switches to Decimal integer mode.

Notation: This menu item allows the floating point registers to be displayed in Fixed, Scientific, or Engineering notation.

Significant Digits: This menu item sets the number of significant digits displayed after the decimal point in floating point mode.

Set/Clear Carry Flag: This menu item sets and clears the Carry flag in integer mode. The current state of the Carry flag is indicated in the status area below the X register display.

Swap Register Halves: This menu item swaps the hi & lo halves (according to the current integer word size) of the value in the X register.

Signed Ints: A check mark beside this menu item indicates that numbers will be interpreted as Signed integers. The most significant bit (in the current word size) represents the sign bit. If this bit is 1, the number is considered negative and in two’s complement notation. If the bit is 0, the number is considered positive. When this menu item is unchecked, all numbers are interpreted as Unsigned (positive) integers.

Sign-Extension: This menu item toggles the use of sign-extension when in signed integer mode. If digit entry has been terminated, changing to a larger word size causes all registers to be sign-extended to the new word size. Otherwise, if digit entry is still active, only the Y, Z, and T registers are sign-extended. In unsigned integer mode, this menu item is dimmed.

Word Size: This menu item sets the calculator’s integer computational word size to 32 bits, 16 bits, or 8 bits (i.e. 4 bytes, 2 bytes, or 1 byte). This is useful when working with microprocessors that use these sizes in their address and data registers. Changing the word size does not terminate digit entry. However, any values that are currently in the stack registers may be invalidated (due to truncation or not being sign-extended). Attempting to enter a number greater than that allowed in the current word size results in a warning sound. The current word size is indicated in the status area below the X register display.

Byte/Nibble Marks: This menu item toggles the display of byte and nibble marks when the calculator’s number base is set to Binary. In any other number base, this item is dimmed.

Leading Zeros: This menu item toggles the display of leading zeros when the calculator’s number base is set to Hexadecimal, Octal, or Binary. In the Decimal number base, this item is dimmed. The number of leading zeros displayed is dependent on the current word size and number base.

Floating Point: This menu item puts Bitwise into floating point math mode. It is equivalent to the Flt key on the calculator’s keypad.

Hexadecimal, Decimal, Octal, Binary: These menu items put Bitwise into integer math mode and select the number base in which the calculator’s registers are displayed. These items are equivalent to the Hex, Dec, Oct, and Bin keys on the calculator’s keypad.

THE OTHER MENUS§

Apple Menu: Selecting About Bitwise… displays the About box, which includes the version number and a brief list of keyboard equivalents. (Note: Holding down the option key while dismissing the About box resets the calculator’s window to its default location.)

Selecting Help… displays the online user’s guide. Use the Home, End, Page Up, Page Down, and Up & Down arrow keys to scroll through the document. You can also use the arrow keys in combination with the Command key for Home and End, and with the Option key for Page Up and Page Down. Click the “Save As…” button (or press Command-S) to save this user’s guide as a standard SimpleText document.

File Menu: Selecting Quit saves all registers, modes, and window position to the Bitwise Preferences file, then exits the application.

Edit Menu: Bitwise supports the Undo, Cut, Copy, Paste, and Clear items of the standard Edit menu. Bitwise can exchange numbers (from the X register only, in any of the four number bases, plus floating point) with other applications that support data exchange via the clipboard. Only text can be pasted into Bitwise. Attempting to paste anything else from the clipboard results in a warning sound and all stack registers remain unchanged. Selecting the Clear item clears the X register to zero whether digit entry is active or not.

To unregister your copy of Bitwise, hold down the option key while clicking on the Edit menu, then select Unregister.

POP-UP STACK REGISTER DISPLAY§

 

Clicking and holding the mouse pointer anywhere in the calculator’s display pops up the Stack Register display window. This window shows the current value in each of the four stack registers. The X register is at the bottom, topped by the Y, Z, and T registers. All values are shown in the current number base.

Dragging the mouse pointer up and down highlights each stack register as the pointer moves over it. Releasing the mouse button when a particular value is highlighted hides the pop-up window and rolls down the stack, making the selected value the new X register.

DRAG & DROP§

Bitwise can exchange numbers (from the X register only, in any of the four number bases, plus floating point) with other applications that support drag & drop.

To drag the number from the X register to another application that supports drag & drop, hold down the option key while clicking anywhere in the X register display, then drag to the destination window. Dragging to the Finder’s desktop creates a clipping file containing the number in the X register. Dragging to the Finder’s Trash clears the X register.

To drag a number from another application or clipping file into the X register, just drop the number anywhere in the calculator’s window. Bitwise interprets the number according to the current number base and digit entry state, just as if it had been typed in from the keypad or pasted in from the clipboard.

HIDING THE KEYPAD§

Clicking in the zoom box on the right of the calculator’s title bar collapses the calculator’s window to just the size of the display. This saves screen space on computers with small monitors. Most of the calculator’s functions can still be performed from the keyboard and numeric keypad. Clicking in the zoom box again restores the calculator to its full size.

DISTRIBUTION§

Since Bitwise is shareware, you are encouraged to copy and distribute Bitwise for non-commercial use. Bitwise may be distributed via the Internet, BBSs, user groups, and online services such as America Online and CompuServe. You may not modify the Bitwise application or documentation in any way.

All other organizations, including (but not limited to) commercial disk vendors of shareware & public domain software, must obtain written permission from Eric Curtis to distribute copies of Bitwise if any fee is charged for the use, copying, or distribution of this product.

COPYRIGHT§

This documentation and the software described in it are copyrighted with all rights reserved. Under the copyright laws, this documentation or the software may not be copied, in whole or in part, without written permission from Eric Curtis, except in the normal use of the software or to make a backup copy. The same proprietary and copyright notices must be affixed to any permitted copies as were affixed to the original. Under the law, copying includes translating into another language or format.

DISCLAIMER OF WARRANTY AND LIABILITY§

BITWISE IS SUPPLIED “AS IS”. ERIC CURTIS MAKES NO WARRANTY, EXPRESS OR IMPLIED, WITH RESPECT TO THE SOFTWARE OR DOCUMENTATION INCLUDING IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.

IN NO EVENT SHALL ERIC CURTIS, OR ANYONE ELSE WHO HAS BEEN INVOLVED IN THE CREATION, TESTING, PRODUCTION, DELIVERY, OR SUPPORT OF THE SOFTWARE OR DOCUMENTATION, BE LIABLE FOR ANY DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES ARISING FROM THE USE, THE RESULTS OF USE, OR THE INABILITY TO USE THE SOFTWARE OR DOCUMENTATION, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.

CREDITS§

Macintosh® is a registered trademark of Apple Computer, Inc. Other brands and their products are trademarks or registered trademarks of their respective companies and should be noted as such.

VERSION HISTORY§

v2.1  20-Apr-1999

• Changed RMD (remainder) function name to MOD (modulus).

• Floating Point modulus.

• Transfer stack.

• Fixed or Scientific notation.

• Significant digits can be set from 0 to 8.

• Floating Point values are right-justified in display.

v2.0  12-Feb-1999

• Floating point math mode (available only to registered users).

• Shareware registration dialog.

• About box shows registered user's name.

v1.8.2  2-Feb-1998

• RMD≠0 flag gets cleared when Carry flag is manually set or cleared.

• F1 key (Undo) is ignored if there’s nothing to undo.

• Bitwise Preferences file.

• Built-in user’s guide.

• Tweaked Bitwise’ application icon.

• Various cosmetic changes and code optimizations.

v1.8.1  11-Sep-1997

• Number base menu items get restored after temporarily viewing X register in another base.

v1.8  16-Jun-1997

• Macintosh drag & drop to and from the X register.

• Special cursors for pop-up stack register display and drag & drop.

• Window position automatically resets if off screen.

• Native 68K & PPC fat application.

• About box automatically dismisses itself after 30 seconds.

• The F1 thru F4 (Undo, Cut, Copy, Paste) and Clear keys are now supported.

v1.7  18-Mar-1997

• Swap register halves.

• Undo last operation.

• Now requires System 7 or above.

v1.6  11-Sep-1996

• Menu command-key equivalents can be invoked with the option key down.

• Calculator’s keypad background uses the currently selected System utilities pattern.

• Leading zeros are copied to the clipboard when that option is active.

• Oops sound now plays asynchronously.

• Various minor cosmetic improvements.

v1.5.1  13-Oct-1995

• Calculator appears correctly across multiple monitors with differing bit depths.

v1.5  28-Jul-1995

• Rotate left and rotate right, optionally through the carry flag.

• Keypad buttons for signed/unsigned integer mode and change sign.

• Updated mailing address.

v1.4.2  14-Mar-1994

• Two’s complement now correctly sets overflow flag in unsigned integer mode.

v1.4.1  31-Dec-1993

• Byte/nibble marks are drawn according to word size.

v1.4  22-Nov-1993

• Signed and unsigned integer modes.

• Optional sign-extension when changing to a larger word size.

• RMD≠0 flag.

• Two’s complement.

• Temporarily view X register in another base.

• Arithmetic shift right.

• Improved internal error handling.

v1.3.1  22-Sep-1993

• Fixed parameter type mismatches in several functions.

v1.3  2-Sep-1993

• First public release.